package com.millstein.rothn.controller;

import com.millstein.rothn.service.UploadService;
import com.millstein.rothn.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("upload")
@CrossOrigin
public class UploadController {

    @Autowired
    private UploadService uploadService;

    /**
     * 上传图片
     * @param file 上传的图片数据
     * @return
     */
    @PostMapping
    public Result submit(MultipartFile file) {
        String str = uploadService.upload(file);
        return Result.ok(str);
    }
}
